<!DOCTYPE html>
<html>
<head>
    <title>消费记录列表</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="木兰湾管理系统">
    <script type="text/javascript" src="../../static/include/header-css.js"></script>
    <!--tag 编辑-->
    <link rel="stylesheet" href="../../static/css/jquery.tag-editor.css">
</head>
<body>
<div class="weui-search-bar" id="searchBar">
    <form class="weui-search-bar__form" id="search-form">
        <div class="weui-search-bar__box">
            <i class="weui-icon-search"></i>
            <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="搜索" name="name" required="" >
            <a href="javascript:searchData();" class="weui-icon-clear" id="searchClear"></a>
        </div>
        <label class="weui-search-bar__label" id="searchText">
            <i class="weui-icon-search"></i>
            <span>搜索</span>
        </label>
        <input type="hidden" name='page' value="1" id="page"/>
    </form>
    <a href="javascript:searchData()" class="mulanbay-search-btn" id="searchData">搜索</a>
</div>
<!--列表数据显示-->
<div id="dataContent"></div>
<!--滚动加载-->
<div class="weui-loadmore" id="loadingSpan">
    <span class="weui-loadmore__tips">加载中...</span>
</div>
<!--编辑页面-->
<div id="edit-popup" class='weui-popup__container'>
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="toolbar">
            <div class="toolbar-inner">
                <a href="javascript:;" class="picker-button close-popup">关闭</a>
                <h1 class="title">消费信息</h1>
            </div>
        </div>
        <div class="modal-content">
            <div class="white_bg">
                <form id="edit-form">
                    <div class="weui-cell mulanbay_select-before ">
                        <div class="weui-cell__hd" ><label class="weui-label">商品分类<span class="mulanbay-notNull">*</span></label></div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" id="goodsTypeList" type="text" value="" >
                            <input type="hidden" name='goodsTypeId' id="goodsTypeId" value=""/>
                        </div>
                        <div class="weui-cell__hd">
                            <a href="javascript:showAddGoodsType(null);"><img src="../../static/image/add.png" alt="说明"></img></a>
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd"><label class="weui-label">商品子类</label></div>
                        <div class="weui-cell__bd">
                            <div id="subGoodsTypeList"></div>
                        </div>
                        <div class="weui-cell__hd">
                            <a href="javascript:showAddGoodsType('goodsTypeId');"><img src="../../static/image/add.png" alt="说明"></img></a>
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd"><label class="weui-label">购买来源<span class="mulanbay-notNull">*</span></label></div>
                        <div class="weui-cell__bd">
                            <div id="buyTypeList"></div>
                        </div>
                        <div class="weui-cell__hd">
                            <a href="javascript:showAddBuyType();"><img src="../../static/image/add.png" alt="说明"></img></a>
                        </div>
                    </div>
                    <div class="weui-cells__title"><span class='mulanbay_textarea_title'>商品名称</span><span class="mulanbay-notNull">*</span></div>
                    <div class="weui-cells weui-cells_form">
                        <div class="weui-cell">
                            <div class="weui-cell__bd">
                                <textarea class="weui-textarea" placeholder="请输入商品名称" rows="2" name="goodsName" id="goodName">
                                </textarea>
                            </div>
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd">
                            <label class="weui-label">商品价格<span class="mulanbay-notNull">*</span></label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="number" name="price" placeholder="单位:元">
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd"><label class="weui-label">购买时间<span class="mulanbay-notNull">*</span></label></div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" id='buyDate' name="buyDate" type="text" value="">
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd"><label class="weui-label">支付方式<span class="mulanbay-notNull">*</span></label></div>
                        <div class="weui-cell__bd">
                            <div id="paymentList"></div>
                        </div>
                    </div>
                    <div class="weui-cells__title" align="center"><<<--更多选项-->>></div>
                    <div class="weui-cell">
                        <div class="weui-cell__bd">
                            <p>商品数量<span class="mulanbay-notNull">*</span></p>
                        </div>
                        <div class="weui-cell__ft">
                            <div class="weui-count">
                                <a class="weui-count__btn weui-count__decrease"></a>
                                <input class="weui-count__number" type="number" name="amount" value="1" />
                                <a class="weui-count__btn weui-count__increase"></a>
                            </div>
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd"><label class="weui-label">商品运费<span class="mulanbay-notNull">*</span></label></div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="number" placeholder="单位:元" name="shipment">
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd">
                            <label class="weui-label">店铺名称</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" placeholder="" name="shopName">
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd">
                            <label class="weui-label">SKU信息</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" placeholder="" name="skuInfo">
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd">
                            <label class="weui-label">品牌名称</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" placeholder="" name="brand">
                        </div>
                    </div>
                    <div class="weui-cells__title"><span class='mulanbay_textarea_title'><a href="javascript:showEditTag('keywords','/buyRecord/getKeywordsTree','BUY_RECORD');">标签<img src="../../static/image/tag.png"></a></span></div>
                    <div class="weui-cells weui-cells_form">
                        <div class="weui-cell">
                            <div class="weui-cell__bd">
                                <input class="tag-editor-tag" type="tag" placeholder="每输入一个按回车" name="keywords" id="keywords">
                            </div>
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd"><label class="weui-label">消费类型</label></div>
                        <div class="weui-cell__bd">
                            <select class="weui-input" name="consumeType">
                                <option value ="NORMAL">普通消费</option>
                                <option value ="OUTBURST">突发消费</option>
                            </select>
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd"><label class="weui-label">是否二手</label></div>
                        <div class="weui-cell__bd">
                            <input class="weui-switch" type="checkbox" name="secondhand" id="secondhand" data-on-text="true" data-off-text="false">
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd">
                            <label class="weui-label">消费时间</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" id='consumeDate' name="consumeDate" type="text" value="">
                        </div>
                        <div class="weui-cell__hd">
                            <a href="javascript:showInfoMsg('选填，默认是购买时间。消费时间和购买时间有可能不一致，比如电影票是2019-01-01 14:00:00买的，实际上电影开场时间是2019-01-02 15:30:00，此处可以填写2019-01-02 15:30:00。');"><img src="../../static/image/help.png" alt="说明"></img></a>
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd">
                            <label class="weui-label">售出价格</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="number" name="soldPrice" placeholder="单位:元">
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd">
                            <label class="weui-label">售出/作废时间</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" id='deleteDate' name="deleteDate" type="text" value="">
                        </div>
                        <div class="weui-cell__hd">
                            <a href="javascript:showInfoMsg('选填，比如某件衣服2019-01-01买的，在2019-10-10扔掉，此处可以填写2019-10-10。');"><img src="../../static/image/help.png" alt="说明"></img></a>
                        </div>
                    </div>
                    <div class="weui-cells__title"><span class='mulanbay_textarea_title'>备注</span></div>
                    <div class="weui-cells weui-cells_form">
                        <div class="weui-cell">
                            <div class="weui-cell__bd">
                                <textarea class="weui-textarea" placeholder="" rows="3" name="remark"></textarea>
                                <div class="weui-textarea-counter"><span>0</span>/200</div>
                            </div>
                        </div>
                    </div>
                    <input type="text" style="display:none;" name='statable' />
                    <input type="text" style="display:none;" name='id' id="id" value=""/>
                </form>
            </div>
            <br>
            <br>
            <br>
            <a href="javascript:saveData();" class="weui-btn weui-btn_primary weui-footer_fixed-bottom"><label id="edit-button-name">保存</label></a>
        </div>
    </div>
</div>
<!--商品类型编辑页面-->
<div id="edit-goodsType-popup" class='weui-popup__container popup-bottom'>
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="toolbar">
            <div class="toolbar-inner">
                <a href="javascript:$.openPopup('#edit-popup');" class="picker-button close-popup">关闭</a>
                <h1 class="title">商品分类</h1>
            </div>
        </div>
        <div class="modal-content">
            <div class="white_bg">
                <form id="edit-goodsType-form">
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd">
                            <label class="weui-label">分类名称<span class="mulanbay-notNull">*</span></label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" placeholder="" name="name">
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd">
                            <label class="weui-label">行为名称</label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" placeholder="" name="behaviorName">
                        </div>
                        <div class="weui-cell__hd">
                            <a href="javascript:showInfoMsg('用户行为分析使用，默认与名称相同');"><img src="../../static/image/help.png" alt="说明"></img></a>
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd"><label class="weui-label">上级分类</label></div>
                        <div class="weui-cell__bd">
                            <div id="parentGoodsTypeList"></div>
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd">
                            <label class="weui-label">状态</label>
                        </div>
                        <div class="weui-cell__bd">
                            <select class="weui-input" name="status">
                                <option value="ENABLE">可用</option>
                                <option value="DISABLE">不可用</option>
                            </select>
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd"><label class="weui-label">排序号</label></div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="number" placeholder="" name="orderIndex">
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd"><label class="weui-label">加入统计<span class="mulanbay-notNull">*</span></label></div>
                        <div class="weui-cell__bd">
                            <input class="weui-switch" type="checkbox" name="statable" id="statable" data-on-text="true" data-off-text="false">
                        </div>
                    </div>
                    <input type="text" style="display:none;" name='id' id="gtId" value=""/>
                </form>
            </div>
            <br>
            <br>
            <a href="javascript:saveGoodsTypeData();" class="weui-btn weui-btn_primary weui-footer_fixed-bottom"><label>保存</label></a>
        </div>
    </div>
</div>
<!--购买类型编辑页面-->
<div id="edit-buyType-popup" class='weui-popup__container popup-bottom'>
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="toolbar">
            <div class="toolbar-inner">
                <a href="javascript:$.openPopup('#edit-popup');" class="picker-button close-popup">关闭</a>
                <h1 class="title">购买类型</h1>
            </div>
        </div>
        <div class="modal-content">
            <div class="white_bg">
                <form id="edit-buyType-form">
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd">
                            <label class="weui-label">分类名称<span class="mulanbay-notNull">*</span></label>
                        </div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="text" placeholder="" name="name">
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd">
                            <label class="weui-label">状态</label>
                        </div>
                        <div class="weui-cell__bd">
                            <select class="weui-input" name="status">
                                <option value="ENABLE">可用</option>
                                <option value="DISABLE">不可用</option>
                            </select>
                        </div>
                    </div>
                    <div class="weui-cell mulanbay_select-before">
                        <div class="weui-cell__hd"><label class="weui-label">排序号</label></div>
                        <div class="weui-cell__bd">
                            <input class="weui-input" type="number" placeholder="" name="orderIndex">
                        </div>
                    </div>
                    <input type="text" style="display:none;" name='id' id="btId" value=""/>
                </form>
            </div>
            <br>
            <br>
            <a href="javascript:saveBuyTypeData();" class="weui-btn weui-btn_primary weui-footer_fixed-bottom"><label>保存</label></a>
        </div>
    </div>
</div>

<!--TAG编辑页面-->
<div id="edit-tag-popup" class='weui-popup__container'>
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="toolbar">
            <div class="toolbar-inner">
                <a href="javascript:$.openPopup('#edit-popup');" class="picker-button close-popup">关闭</a>
                <h1 class="title">标签信息</h1>
            </div>
        </div>
        <div class="modal-content">
            <div class="white_bg">
                <form id="edit-tag-form">
                    <div class="page-hd">
                        <div class="weui-cells__title"><span class='mulanbay_textarea_title'>标签</span><span class="mulanbay-notNull">*</span></div>
                        <div class="weui-cells weui-cells_form">
                            <div class="weui-cell">
                                <div class="weui-cell__bd">
                                    <input class="weui-input" type="tag-editor-tag" placeholder="每输入一个按回车" name="commonTag" id="commonTag">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="page-bd-15">
                        <div class="weui-label-list">
                            *我的常用：
                            <div id="userTagList"></div>
                            <br><br>
                            *系统推荐：
                            <div id="systemTagList"></div>
                        </div>
                    </div>
                    <br>
                    <br>
                </form>
            </div>
            <br>
            <br>
            <a href="javascript:saveEditTag('keywords');" class="weui-btn weui-btn_primary weui-footer_fixed-bottom"><label id="edit-tag-button-name">确定</label></a>
        </div>
    </div>
</div>

<br>
<a href="javascript:showAdd();" class="weui-btn weui-btn_primary weui-footer_fixed-bottom">新增</a>

<script type="text/javascript" src="../../static/include/footer-js.js"></script>
<!--tag 编辑-->
<script type="text/javascript" src="../../static/js/jquery.tag-editor.min.js"></script>
<script type="text/javascript" src="../../static/js/jquery.caret.min.js"></script>

<script>
    $(function() {
        pushRefresh(getData);
        //pullRefresh();
        getData();
        //初始化编辑页面
        datetimePicker('buyDate',null);
        datetimePicker('consumeDate',null);
        datetimePicker('deleteDate',null);
        initTagEdit(['keywords']);
        pushStateListener();
    });
    function clearBuyRecordForm() {
        clearForm("edit-form");
        removeTag(['keywords']);
    }
    //新增因为select列表加载是异步模式，所以先弹出页面再加载
    function showAdd() {
        $.openPopup('#edit-popup') ;
        clearBuyRecordForm();
        initForm(true,true);
        var nowDate =getNowDateTimeString();
        var formData = {
            amount: 1,
            buyDate:nowDate,
            shipment:0,
            payment:'ALIPAY',
            status:'BUY',
            statable : true,
            consumeType:'NORMAL',
            keywords:null,
            secondhand:false
        };
        $('#edit-form').loadJson(formData);
        setElementInnerHTML('edit-button-name','增加');
    }
    function showAddGoodsType(parentFieldId) {
        $.openPopup('#edit-goodsType-popup') ;
        clearForm("edit-goodsType-form");
        var parentId=0;
        if(parentFieldId!=null){
            parentId= $('#'+parentFieldId).val();
        }
        var url='/goodsType/getGoodsTypeTree?needRoot=true&rootType=SELF&pid=0';
        loadSelectListNormal(url,'parentGoodsTypeList','parentId','parentId',false,false,null);
        var formData = {
            parentId: parentId,
            status: 'ENABLE',
            orderIndex:1,
            statable : true
        };
        $('#edit-goodsType-form').loadJson(formData);
    }
    function saveGoodsTypeData() {
        var postData = form2Json("edit-goodsType-form");
        postData.statable=$("#statable").is(":checked");
        var url='/goodsType/create';
        doFormSubmit(postData,url,function(data){
            $.openPopup('#edit-popup') ;
            if(postData.parentId==0){
                loadGoodsTypeList(true,true);
            }else{
                loadSubGoodsTypeList(postData.parentId,true);
            }
        });
    }
    function showAddBuyType() {
        $.openPopup('#edit-buyType-popup') ;
        clearForm("edit-buyType-form");
        var formData = {
            status: 'ENABLE',
            orderIndex:1
        };
        $('#edit-buyType-form').loadJson(formData);
    }
    function saveBuyTypeData() {
        var postData = form2Json("edit-buyType-form");
        var url='/buyType/create';
        doFormSubmit(postData,url,function(data){
            $.openPopup('#edit-popup') ;
            loadBuyTypeList(true);
        });
    }
    function showAddFromTmp(id) {
        var url='/buyRecord/get?id='+ id;
        doAjax(null,url,'GET',false,function(data){
            $.openPopup('#edit-popup') ;
            clearBuyRecordForm();
            initForm(false,false);
            data.goodsTypeId=data.goodsType.id;
            if(data.subGoodsType){
                data.subGoodsTypeId=data.subGoodsType.id;
            }
            data.buyTypeId=data.buyType.id;
            data.id=null;
            data.skuInfo=null;
            //data.totalPrice=0;
            var dd = new Date();
            var bt = dd.Format('yyyy-MM-dd hh:mm:ss');
            data.buyDate=bt;
            data.consumeDate=null;
            data.goodsName=null;
            document.getElementById('goodsTypeList').value=data.goodsType.name;
            if(data.subGoodsType){
                loadSubGoodsTypeList(data.goodsType.id);
            }
            $('#edit-form').loadJson(data);
            //$('#keywords').tagEditor('addTag',data.keywords);
        });
        setElementInnerHTML('edit-button-name','增加');
    }
    //修改或模板新增因为select列表加载是同步模式，所以先加载再弹出页面
    function showEdit(id) {
        var url='/buyRecord/get?id='+ id;
        doAjax(null,url,'GET',false,function(data){
            $.openPopup('#edit-popup') ;
            clearBuyRecordForm();
            data.goodsTypeId=data.goodsType.id;
            if(data.subGoodsType){
                data.subGoodsTypeId=data.subGoodsType.id;
            }
            data.buyTypeId=data.buyType.id;
            //初始化表单（列表此时无法异步，否会导致值设置不正确）
            initForm(false,false);
            document.getElementById('goodsTypeList').value=data.goodsType.name;
            loadSubGoodsTypeList(data.goodsType.id,false);
            $('#edit-form').loadJson(data);
        });
        setElementInnerHTML('edit-button-name','修改');
    }
    function saveData() {
        var postData = form2Json("edit-form");
        var secondhand = $("#secondhand").is(":checked");
        postData.secondhand=secondhand;
        var create=false;
        var url='/buyRecord/edit';
        if($("#id").val()==null||$("#id").val()==''){
            url='/buyRecord/create';
            create=true;
        }
        doFormSubmit(postData,url,function(data){
            $.closePopup('#edit-popup') ;
            if(create){
                getData();
                gotoTop();
            }else {
                var hh = createRow(data);
                setElementInnerHTML(getDivId(data.id),hh);
            }
        });
    }
    function showDelete(id) {
        var delUrlPrefix = '/buyRecord/delete';
        commonDeleteByIds(delUrlPrefix,id,function () {
            //searchData();
            //直接把该节点删除
            setElementInnerHTML(getDivId(id),'');
        });
    }
    function initForm(selectFirst,async) {
        loadGoodsTypeList(selectFirst,async);
        loadBuyTypeList(async);
        loadPaymentList(async);
    }
    function loadGoodsTypeList(selectFirst,async){
        var url='/goodsType/getGoodsTypeTree?pid=0';
        loadSelectList(url,'goodsTypeList','goodsTypeId','请选择商品类型',selectFirst,async,function (ov,nv) {
            //加载子商品
            loadSubGoodsTypeList(nv,async);
        },null);
    }
    //采用js模式的子类级联模式有一个bug:第一次设置后以后就再也无法重新设置，因此这里采用传统模式
    function loadSubGoodsTypeList(pid,async){
        var url='/goodsType/getGoodsTypeTree?pid='+pid;
        loadSelectListNormal(url,'subGoodsTypeList','subGoodsTypeId','subGoodsTypeId',false,async,null);
    }
    //采用js模式的子类级联模式有一个bug:第一次设置后以后就再也无法重新设置，因此这里采用传统模式
    function loadBuyTypeList(async){
        var url='/buyType/getBuyTypeTree';
        loadSelectListNormal(url,'buyTypeList','buyTypeId','buyTypeId',true,async,null);
    }
    function loadPaymentList(async){
        var url='/common/getEnumTree?enumClass=Payment';
        loadSelectListNormal(url,'paymentList','payment','payment',true,async,null);
    }
    function searchData() {
        setPage(1);
        getData();
    }
    function getData() {
        var url = '/buyRecord/getData';
        loadListData('search-form','dataContent','page',url,createRow,null);
    }
    function getDivId(id) {
        return 'BuyRecord'+id;
    }
    function createRow(rowData) {
        var html='';
        html+='<div id="'+getDivId(rowData.id)+'">';
        html+='<div class="weui-form-preview">';
        html+='    <a class="weui-cell  weui-cell_access weui-cell_example" href="javascript:showEdit('+rowData.id+');">\n';
        html+='        <div class="weui-cell__hd"><img src="../../static/image/buy.png"></div>\n';
        html+='        <div class="weui-cell__bd">\n';
        html+='<label class="weui-form-preview__label">'+rowData.buyDate+'</label>';
        html+='        </div>\n';
        html+='        <div class="weui-cell__ft">¥'+rowData.totalPrice+'</div>\n';
        html+='    </a>\n';
        html+='    <div class="weui-form-preview__bd">\n';
        html+='        <div class="weui-form-preview__item">\n';
        html+='            <label class="weui-form-preview__label">商品分类</label>\n';
        var goodTypename = rowData.goodsType.name;
        if(rowData.subGoodsType){
            goodTypename+='('+rowData.subGoodsType.name+')';
        }
        html+='            <span class="weui-form-preview__value">'+goodTypename+'</span>\n';
        html+='        </div>\n';
        html+='        <div class="weui-form-preview__item">\n';
        html+='            <label class="weui-form-preview__label">购买来源</label>\n';
        html+='            <span class="weui-form-preview__value">'+rowData.buyType.name+'</span>\n';
        html+='        </div>\n';
        html+='        <div class="weui-form-preview__item">\n';
        html+='            <label class="weui-form-preview__label">商品名称</label>\n';
        var goodsName = rowData.goodsName;
        if(rowData.secondhand==true){
            goodsName = '<a href="javascript:showInfoMsg(\'二手产品。\');"><img src="../../static/image/2.png" alt="说明"></img></a>'+goodsName;
        }
        html+='            <span class="weui-form-preview__value mulanbay-dark-font">'+goodsName+'</span>\n';
        html+='        </div>\n';
        html+='    </div>\n';
        html+='    <div class="weui-form-preview__ft">\n';
        html+='        <a class="weui-form-preview__btn weui-form-preview__btn_default" href="javascript:showAddFromTmp('+rowData.id+');">以此为模板</a>\n';
        html+='        <button type="submit" class="weui-form-preview__btn weui-form-preview__btn_delete" onclick="javascript:showDelete('+rowData.id+');">删除</button>\n';
        html+='    </div>\n';
        html+='</div>\n';
        html+='</div>\n';
        html+='<br>\n';
        return html;
    }
</script>
</body>
</html>